import { useMapper } from "./useMapper";
import { mapGetters, createNamespacedHelpers } from "vuex";

export function useGetters(moduleName,mapper) {
  let mapFn = mapGetters;
  if (typeof moduleName === "string" && moduleName.length > 0) {
    mapFn = createNamespacedHelpers(moduleName).mapGetters;
  }else{
    mapper=moduleName
  }
  const storeState = useMapper(mapper, mapFn);

  return storeState;
}
